package com.ojoin.trade.supplyloan_core.web.service;

import java.util.List;
import java.util.Map;

import org.springframework.data.domain.Pageable;

import com.ojoin.trade.common.web.service.BaseService;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlSupplyInventory;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlSupplyPayment;

public interface TbSlSupplyInventoryService extends
		BaseService<TbSlSupplyInventory> {

	/**
	 * 按平台用户删除历史数据
	 */

	int delete(Integer platformAccountId);
	
	int delete(Integer platformAccountId,String rowCreateTime);
	
    String getLastInsertTime(int platformAccountId);
    
    String getLastStoreDate(int platformAccountId);
    
    String getLastStoreDate(int platformAccountId,String itemStatus);
    
    
	/**
	 * 按平台查询数据
	 */

	List<TbSlSupplyInventory> queryInventoryByRowCreateTime(int platformAccountId,
			String rowCreateTimeStart,String rowCreateTimeEnd);
	
	List<TbSlSupplyInventory> queryInventoryByRowCreateTime(int platformAccountId,
			String rowCreateTimeStart,String rowCreateTimeEnd, String itemStatus);
	
	List<TbSlSupplyInventory> queryInventoryByRowCreateTime(int platformAccountId,
			String rowCreateTimeStart,String rowCreateTimeEnd, String itemStatus,Pageable page);
	
	List<TbSlSupplyInventory> queryInventory(int platformAccountId,
			String rowCreateTimeStart,String rowCreateTimeEnd,String storeDateStart, String storeDateEnd, String itemStatus,Pageable page);
	
	
	List<TbSlSupplyInventory> queryInventoryByStoreDate(int platformAccountId,
			String storeDateStart, String storeDateEnd);
	
	List<TbSlSupplyInventory> queryInventoryByStoreDate(int platformAccountId,
			String storeDateStart, String storeDateEnd,String itemStatus);
	
	List<TbSlSupplyInventory> queryInventoryByStoreDate(int platformAccountId,
			String storeDateStart, String storeDateEnd,String itemStatus,Pageable page);
	
	Map<Integer,List<TbSlSupplyInventory>> queryByMerchantUser(int idOfTbMerchantUser,String DateStart, String DateDateEnd,String settlementState);

	
	/**
	 * 按平台查询数据
	 */

	Map<String, TbSlSupplyInventory> queryInventoryMap(
			int platformAccountId);
	
	Map<String, TbSlSupplyInventory> queryInventoryMap(
			int platformAccountId,String itemStatus);
	
	Map<String, TbSlSupplyInventory> queryInventoryByStoreDateMap(
			int platformAccountId, String storeDateStart, String storeDateEnd);

	Map<String, TbSlSupplyInventory> queryInventoryInByStoreDateMap(
			int platformAccountId, String storeDateStart, String storeDateEnd);
	
	Map<String, TbSlSupplyInventory> queryInventoryOutByStoreDateMap(
			int platformAccountId, String storeDateStart, String storeDateEnd);
	
	
	Map<String, TbSlSupplyInventory> queryInventoryByStoreDateMap(
			int platformAccountId, String storeDateStart, String storeDateEnd,String itemStatus);
	
	
	/**
	 * 获取平台库存值
	 * 
	 * @return
	 */
	
	long queryInventoryInMoneyByStoreDate(int platformAccountId, String storeDateStart, String storeDateEnd);

	long queryInventoryOutMoneyByStoreDate(int platformAccountId, String storeDateStart,String storeDateEnd);

	long queryInventoryMoneyByStoreDate(int platformAccountId, String storeDateStart,String storeDateEnd,String itemStatus);
	
	
	long queryInventoryInMoneyByRowCreateTime(int platformAccountId, String rowCreateTimeStart,String rowCreateTimeEnd);

	long queryInventoryOutMoneyByRowCreateTime(int platformAccountId, String rowCreateTimeStart,String rowCreateTimeEnd);
	
	long queryInventoryMoneyByRowCreateTime(int platformAccountId, String rowCreateTimeStart,String rowCreateTimeEnd,String itemStatus);
	
	long queryInventoryMoney(int platformAccountId,String storeDateStart,String storeDateEnd, String rowCreateTimeStart,String rowCreateTimeEnd,String itemStatus);
	

    /*
     *  获取所有入库，全量
     */
	long queryInventoryInMoney(int platformAccountId);

	 /*
     *  获取所有退货，全量
     */
	
	long queryInventoryOutMoney(int platformAccountId);
	
	void deleteRepeat(int platformAccountId);

	
	/**
	 * 删除结算单相同单据
	 * @param list
	 */
	
	void removeInventoryCommon(List<TbSlSupplyInventory> list,Map<String,TbSlSupplyInventory> MapDB);
	
	/**
	 *  库存中存在，抓取数据不存在
	 */
	List<TbSlSupplyInventory> changeToPay(Map<String,TbSlSupplyInventory> MapDB);
	
	
	
}
